package org.tgcloud.group.core.WXServiceUtils;

/**
 * @author: zhy
 * @create: 2023-12-31 09:16
 * @description: Ticket封装
 */
public class Ticket {

    /** ticket */
    private String ticket;

    /** 过期时间 */
    private long expiresTime;

    public String getTicket() {
        return ticket;
    }

    public void setTicket(String ticket) {
        this.ticket = ticket;
    }

    public long getExpiresTime() {
        return expiresTime;
    }

    public void setExpiresTime(long expiresTime) {
        this.expiresTime = expiresTime;
    }

    public Ticket(String ticket, String expiresIn) {
        super();
        this.ticket = ticket;
        this.expiresTime = System.currentTimeMillis() + Integer.parseInt(expiresIn)*1000;
    }

    /**
     * 判断token是否过期
     * @return
     */
    public boolean isExpired(){
        return System.currentTimeMillis() > this.expiresTime;
    }

}
